"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const vue = require("vue");
const antDesignVue = require("ant-design-vue");
const _hoisted_1 = { class: "me-short-cut" };
const _hoisted_2 = { class: "me-short-cut-inner" };
const _hoisted_3 = { class: "me-short-cut-content" };
const _hoisted_4 = ["onClick"];
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
  ...{
    name: "me-short-cut"
  },
  __name: "short-cut",
  props: {
    items: { default() {
      return [];
    } }
  },
  emits: ["select"],
  setup(__props, { emit: __emit }) {
    const emits = __emit;
    const props = __props;
    const show = vue.ref(false);
    const currentValue = vue.ref("");
    vue.watchEffect(() => {
      if (!show.value) {
        currentValue.value = "";
      }
    });
    const onTrigger = (isShow) => {
      show.value = !!isShow;
    };
    const onClick = (item) => {
      currentValue.value = item.value;
      onTrigger(false);
      emits("select", item);
    };
    return (_ctx, _cache) => {
      return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
        vue.createElementVNode("div", _hoisted_2, [
          vue.createVNode(vue.unref(antDesignVue.Dropdown), {
            visible: show.value,
            "onUpdate:visible": _cache[0] || (_cache[0] = ($event) => show.value = $event),
            trigger: "click",
            "overlay-class-name": "me-short-cut-overlay",
            placement: "topLeft"
          }, {
            overlay: vue.withCtx(() => [
              vue.renderSlot(_ctx.$slots, "overlay", {}, () => [
                vue.createElementVNode("div", _hoisted_3, [
                  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.items, (item, index) => {
                    return vue.openBlock(), vue.createElementBlock("div", {
                      onClick: ($event) => onClick(item),
                      class: vue.normalizeClass(["me-short-cut-item", { active: currentValue.value === item.value }]),
                      key: index
                    }, vue.toDisplayString(item.label), 11, _hoisted_4);
                  }), 128))
                ])
              ])
            ]),
            _: 3
          }, 8, ["visible"]),
          vue.renderSlot(_ctx.$slots, "default", vue.normalizeProps(vue.guardReactiveProps({ onTrigger })))
        ])
      ]);
    };
  }
});
exports.default = _sfc_main;
//# sourceMappingURL=short-cut.vue2.cjs.map
